<?php

/**
 * @author SonNguyen
 * @copyright 2013
 */

class admin_model extends CI_Model
{
	function __construct()
	{
		parent::__construct('');
	}
	public function checkstr(){
		return "Q U E R T Y U I O P A S D F G H J K L Z X C V B N M q w  e r t y u i o p a s d f g h j k l z x c v b n m";
	}
	public function checkstr2(){
		return "ứ ừ ữ ử ự ớ ờ ở ỡ ợ ố ồ ổ ỗ ộ ắ ằ ẵ ẳ ặ Ứ Ừ Ử Ữ Ự Ớ Ờ Ở Ỡ Ợ Ố Ồ Ổ Ỗ Ộ Ắ Ằ Ẳ Ẵ Ặ";
	}
	public function province($provinceid=""){
		$combo_province = $this->model->table('province','id')->where('isdelete',0)->order_by('name')->find_combo('id','name','Tỉnh thành...');
        return  form_dropdown('data[provinceid]',$combo_province,$provinceid,'id="province" class="select" style="width:200px; height:21px; padding:1px 2px ;"');
       	
	}
	public function district($districtid="",$provinceid=""){
		$combo_district = $this->model->table('district','id')->where('isdelete',0)->where('provinceid',$provinceid)->order_by('name')->find_combo('id','name','Quận huyện...');
        return form_dropdown('data[districtid]',$combo_district,$districtid,'id="district" class="select" style="width:200px; height:21px; padding:1px 2px ;"');
       
	}
	public function resizeImg($image_data,$folder, $width, $height){
        $this->load->library('image_lib');
        $configz = array();
        $configz['image_library'] = 'gd2';
        $configz['source_image'] = './files/'.$folder.'/' . $image_data;
        $configz['new_image'] = './files/'.$folder.'/' . $image_data;
        $configz['create_thumb'] = TRUE;
        $configz['maintain_ratio'] = TRUE;
        $configz['width'] = $width;
        $configz['height'] = $height;

        $this->image_lib->initialize($configz);
        $this->image_lib->resize();
        $this->image_lib->clear();
    }
    public function set_upload_options($folder) {
        $config = array();
        $config['allowed_types'] = 'jpg|jpeg|gif|png|swf';
        $config['upload_path'] = './files/'.$folder.'/';
        $config['encrypt_nam'] = 'TRUE';
        $config['remove_spaces'] = TRUE;
        $config['max_size'] = 10024;
        return $config;
    }
	public function resizeImgs($image_data,$folder){
        $this->load->library('image_lib');
        $configz = array();
        $configz['image_library'] = 'gd2';
        $configz['source_image'] = './files/'.$folder.'/' . $image_data;
        $configz['new_image'] = './files/'.$folder.'/' . $image_data;
        $configz['create_thumb'] = TRUE;
        $configz['maintain_ratio'] = TRUE;
        //$configz['width'] = $width;
        //$configz['height'] = $height;

        $this->image_lib->initialize($configz);
        $this->image_lib->resize();
        $this->image_lib->clear();
    }
}
?>